package com.cskaoyan.javase.homework.primary._6object;

/**
 * getClass方法的语法练习编程题
 *
 * @since 20:44
 * @author wuguidong@cskaoyan.onaliyun.com
 */
public class GetClazzDemo {
    public static void main(String[] args) {
        A a = new A();
        Class ac1 = a.getClass();
        A a2 = new A();
        Class ac2 = a2.getClass();

        System.out.println(ac1 == ac2);
        B b = new B();
        Class bc = b.getClass();
        System.out.println(ac1 == bc);
    }


    public static boolean judgeType(Object o1, Object o2) {
        if (o1 != null && o2 != null) {
            return o1.getClass() == o2.getClass();
        }
        return o1 == o2;
    }
}

class A {
}

class B {
}
